<?php	
	/*
		Template Name: Redirect
	*/
//Page Redirect to first sub page
?>
<?php get_header('none'); ?>

<div class="content-area">
	<div class="container">
	
		<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
			
		<?php
			$post = get_post();
			 $args = array(
				'sort_order' => 'asc',
				'sort_column' => 'menu_order',
				'hierarchical' => 1,
				'parent' => $post->ID,
				'post_status' => 'publish'
			); 
			$pagekids = get_pages($args);
			if ($pagekids) {?>
			<?php	
				$firstchild = $pagekids[0];
				$redirect_url = get_permalink($firstchild->ID);
				
				echo '<meta http-equiv="refresh" content="0;URL='.$redirect_url.'" />';
				exit;
			?>
		<?php }?>
			
		<?php endwhile;endif; ?>
		
	</div>
</div>

<?php get_footer();?>